﻿Imports System.IO
Imports System.Windows.Markup

Public Class AboutWindow

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnOK.Click


        Me.ViewerCopyright.Document = Nothing
    End Sub




    ''' <summary>
    ''' 获取与应用程序关联的标题。
    ''' </summary>
    Public ReadOnly Property ApplicationTitle As String
        Get
            If My.Application.Info.Title <> "" Then
                Return My.Application.Info.Title
            Else
                Return System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
            End If
        End Get
    End Property

    ''' <summary>
    ''' 获取与应用程序关联的产品名称。
    ''' </summary>
    Public ReadOnly Property ProductName As String
        Get
            Return My.Application.Info.ProductName
        End Get
    End Property

    ''' <summary>
    ''' 获取应用程序的版本号。 
    ''' </summary>
    Public ReadOnly Property Version As String
        Get
            Return My.Application.Info.Version.ToString
        End Get
    End Property


    ''' <summary>
    ''' 获取与应用程序关联的版权声明。  
    ''' </summary>
    Public ReadOnly Property Copyright As String
        Get
            Return My.Application.Info.Copyright
        End Get
    End Property

    ''' <summary>
    ''' 获取与该应用程序关联的公司名称
    ''' </summary>
    Public ReadOnly Property CompanyName As String
        Get
            Return My.Application.Info.CompanyName
        End Get
    End Property

    ''' <summary>
    ''' 获取与应用程序关联的说明
    ''' </summary>
    Public ReadOnly Property Description As String
        Get
            Return My.Application.Info.Description
        End Get
    End Property


    Private Shared OtherCopyRightDocument As FlowDocument

    ''' <summary>
    ''' 获取该应用程序使用的外部组建的版权声明
    ''' </summary>
    Public ReadOnly Property OtherCopyRight As FlowDocument
        Get
            If OtherCopyRightDocument IsNot Nothing Then Return OtherCopyRightDocument

            Dim content As FlowDocument = TryCast(XamlReader.Parse(My.Resources.OtherCopyRight), FlowDocument)

            OtherCopyRightDocument = If(content IsNot Nothing, content, New FlowDocument)

            Return OtherCopyRightDocument
        End Get
    End Property

    ''' <summary>
    ''' 导航链接
    ''' </summary>
    Private Sub hyperlink_RequestNavigate(ByVal sender As Object, ByVal e As System.Windows.Navigation.RequestNavigateEventArgs)
        If e.Uri IsNot Nothing AndAlso String.IsNullOrEmpty(e.Uri.OriginalString) = False Then
            Dim uri As String = e.Uri.AbsoluteUri
            Process.Start(New ProcessStartInfo(uri))
            e.Handled = True
        End If
    End Sub


End Class
